package com.gcit.seniorWish.web.modular.examinee.service;

import com.gcit.seniorWish.web.common.constant.cache.Cache;
import com.gcit.seniorWish.web.common.constant.cache.CacheKey;
import com.gcit.seniorWish.web.common.persistence.model.SeniorExaminee;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.baomidou.mybatisplus.service.IService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 * 中考考生信息表 服务类
 * </p>
 *
 * @author tonglu
 * @since 2018-03-20
 */
public interface ISeniorExamineeService extends IService<SeniorExaminee> {

	/**
	 * 考生导入
	 * @param inputStream
	 * @return
	 */
	String importExaminee(InputStream inputStream);

	/**
	 * 关联学校,班级根据不同的登录角色查询数据
	 * 
	 * @param page
	 * @param seniorSchoolId
	 * @param seniorClassId
	 * @param examCardNumber
	 * @param confirmStatus
	 * @return
	 */
	List<Map<String, Object>> getExaminees(Pagination page, String seniorSchoolId, String seniorClassId,
			String examCardNumber, String confirmStatus);


	SeniorExaminee getExamineeByExamCardNumber(String examCardNumber);

	SeniorExaminee getExamineeByExamCardNumberWithSchoolClassName(String examCardNumber);

	@Transactional
	@CacheEvict(value = Cache.BUSS, key = "'" + CacheKey.EXAMINEE_INFO_BY_EXAM_CARD + "'+#examinee.examCardNumber")
	int updateExaminee(SeniorExaminee examinee);

	@Transactional
	@CacheEvict(value = Cache.BUSS, key = "'" + CacheKey.EXAMINEE_INFO_BY_EXAM_CARD + "'+#examinee.examCardNumber")
	void mergeExaminee(SeniorExaminee examinee);

	/**
	 * 导出志愿信息表
	 * @param response
	 * @param seniorSchoolId
	 * @param seniorClassId
	 * @param examCardNumber
	 * @param confirmStatus
	 * @throws IOException
	 */
	void exportExaminee(HttpServletResponse response, String seniorSchoolId, String seniorClassId, String examCardNumber, Integer confirmStatus) throws IOException;
}
